
import axiosHttp from '../axios/index'

interface UserService{
    login(data:any) : Promise<any>;
    userInfo():Promise<any>;
    list():Promise<any>;
    updata(data:any) : Promise<any>;
    add(data:any) : Promise<any>;
    del(data:any) : Promise<any>;
}

const User: UserService = {
    //修改用户信息
    del(data:any){
        return axiosHttp.request({
            url: 'user/del/'+data,
            method: 'delete',
            tokenCode: true,
            loadingShow: true,
          
        });
    },
     //修改用户信息
    add(data:any){
        return axiosHttp.request({
            url: 'user/add',
            method: 'post',
            tokenCode: true,
            loadingShow: true,
            data    
        });
    },
     //修改用户信息
    updata(data:any){
        return axiosHttp.request({
            url: 'user/updata',
            method: 'put',
            tokenCode: true,
            loadingShow: true,
            data    
        });
    },
    //用户列表
    list(){
        return axiosHttp.request({
            url: 'user/list',
            method: 'get',
            tokenCode: true,
            loadingShow: true,
                      
        });
    },
    //用户详情
    userInfo(){
        return axiosHttp.request({
            url: 'user/info',
            method: 'get',
            tokenCode: true,
            loadingShow: true,
                      
        });
    },
    //账号密码登录
    login(data:any) {
        return axiosHttp.request({
            url: 'user/login',
            method: 'post',
            tokenCode: false,
            loadingShow: true,
            loadinfText: '登录成功',
            data
        });
    }
};
export default User;